@extends('web.layouts.app')

@section('styles')
    <link rel="stylesheet" type="text/css" href="{{ asset('resources/web/css/ucenter.css')}}">
    <link rel="stylesheet" type="text/css" href="{{ asset('resources/web/css/base.css')}}">
@endsection

@section('content')
    <!--container-->
    <div class="uc-wrap swrap mt20">
        <div class="uc-side L">
            <div class="uc-nav">
                <ul>
                    @include('web.user_center.menu')
                </ul>
            </div>
        </div>
        <div class="uc-main uc-mainbg user-invitation-gift R">
            <div class="plr10">
                <!--邀请链接-->
                <ul class="user-invitation-link">
                    <li>
                        <label>经纪人注册链接</label>
                        <input type="text" class="link-txt" id="J_invitation_link" value="{{$invite_next_agent_url}}">
                    </li>
                    <button type="button" id="J_copylink" class="btn">复制链接</button>
                </ul>
            </div>
            <!--查询表单-->
            <div class="user-custom-search ml20">
                <form method="get" action="">
                    <span>经纪人：</span>
                    <input type="text" class="txt" name="next_agent_name" value="{{$query['next_agent_name']}}">
                    <span class="ml20">经纪人编码：</span>
                    <input type="text" class="txt" name="next_agent_code" value="{{$query['next_agent_code']}}">
                    <input type="submit" class="btn" value="查询">
                </form>
            </div>
            <!-- 展示 -->
            <div class="profit_Exhibition uc-mainbg  clearfix">
                <ul>
                    <li>总投资金额：<span>{{$all['use_money']}}</span>元</li>
                    <li>总推荐费用：<span>{{$all['invite_money']}}</span>元</li>
                    <li>返利：<span>{{$all['return_money']}}</span>元</li>
                </ul>
            </div>
            <!--列表-->
            <div class="user-item-list">
                <ul class="data-list custom-list">
                    <li class="th">
                        <div class="col-nackname">经纪人</div>
                        <div class="col-name">经纪人编码</div>
                        <div class="col-number">已投资用户人数</div>
                        <div class="col-income">总投资金额(元)</div>
                        <div class="col-time">总推荐费用(元)</div>
                        <div class="col-status">返利(元)</div>
                        <div class="col-handle">操作</div>
                    </li>
                    @foreach($lists as $list)
                    <li>
                        <div class="col-nackname">{{!empty($list->name)?$list->name:(!empty($list->phone_number)?$list->phone_number:$list->username)}}</div>
                        <div class="col-name">{{empty($list->invite_code)?'--':$list->invite_code}}</div>
                        <div class="col-number">{{empty($list->valid_num)?'--':$list->valid_num}}</div>
                        <div class="col-income">{{empty($list->use_money)?'--':$list->use_money}}</div>
                        <div class="col-time">{{empty($list->invite_money)?'--':$list->invite_money}}</div>
                        <div class="col-status orange">{{empty($list->return_money)?'--':$list->return_money}}</div>
                        <div class="col-handle"><a class="blue" href="{{'/agent/nextAgentUser?second_broker_code='.$list->invite_code.'&menu=15'}}">查看详情</a></div>
                    </li>
                    @endforeach
                </ul>
                <div class="uc-page-box text-right">
                    {!! $links !!}
                </div>
            </div>

        </div>
    </div>
    <!--container /-->
@endsection

@section('scripts')
    <script src="{{ asset('resources/web/js/index.js') }}"></script>
    <script src="{{ asset('resources/web/js/jquery.min.js') }}"></script>
    <script type="text/javascript" src="{{asset('resources/web/plugins/datePicker/WdatePicker.js')}}"></script>
    <script type="text/javascript">
        $(function(){
            $('.btn').click(function(){
                document.getElementById("J_invitation_link").select();// 选择对象
                document.execCommand("Copy");// 执行浏览器复制命令
            })
        });
    </script>
@endsection